bandejaR                package:unknown                R Documentation

BandejaR

Description:

     BandejaR is a function that estimates the time spent to have lunch in each one of the university restaurants of University of So Paulo (Bandejo da Prefeitura, Bandejo da Fsica, Bandejo da Qumica e Bandejo Central).
     It considers the way the user chose to go to a restaurant, the rain and the quality of the restaurants' menus.

Usage:

     bandejaR = function(deslocamentos, IES_ORIGEM, chuva = FALSE, circular = FALSE, card_pref, card_fis, card_quim, card_cen) #cria a funo bandejaR com seus parmetros
 

Arguments:

deslocamentos	must be a dataframe with the institutes of USP and the time of displacement between their "bandejes".
 		When the user will go to the bandejo by walking, they must insert deslocamentos as the dataframe "deslocamentos_bandejoes_andando.csv".
		If the user prefers the car or the bus, they must insert deslocamentos as the dataframe "deslocamentos_bandejoes_carro.csv"
IES_ORIGEM	origin institute of the user. Example: If I am a biology student and I am at ib, I must ser IES_ORIGEM = "ib". 
		The bandejaR function assumes that the user leaves the institute and then returns to it.
		Must be one of these strings:  eca   eefe  poli  fau   fcf   fea   fe    fflch 
		fmzv  fo    iag   ib    icb   iee   iea   ieb   if    igc   ime   ip    iq    iri
		io    mae   cepe 
chuva		can be TRUE or FALSE. Must be TRUE when its raining. FALSE is the default.
circular	can be TRUE or FALSE. Must be TRUE when the user goes to "bandejo" using the bus. 
		It estimates the waiting time for the "circulares" buses.
card_pref	Can be set as "Bom", "Medio" or "Ruim". Refers to the user opinion about the general quality of the "bandejo da prefeitura"'s menu.
card_fis	Can be set as "Bom", "Medio" or "Ruim". Refers to the user opinion about the general quality of the "bandejo da fsica"'s menu.
card_quim	Can be set as "Bom", "Medio" or "Ruim". Refers to the user opinion about the general quality of the "bandejo da qumica"'s menu.
card_cen	Can be set as "Bom", "Medio" or "Ruim". Refers to the user opinion about the general quality of the "bandejo central"'s menu.

Details:

The BandejaR function provides a time estimative to the act of having lunch in one of the university restaurants of USP, known as "bandejes". 
It uses Line Theory to model the total time that a user usually spends going to the university restaurants, having lunch and returning to its institute.
It calculates the flow for each one of the university restaurants, considering a standard estimation of the line sizes based on the quality of the menu of each restaurant.
BandejaR assumes that better quality menus will imply in bigger lines, considering that many people chose the university restaurant according to the menu option. 
For example, a menu that includes lasagna or strogonoff usually attracts more students.
The BandejaR also consider that when it is raining, the lines tend to be smaller, because the only university restaurant that has rain shelter is the Bandejo Central.
The BandejaR estimates how the user goes to the university restaurants (by car, walking or by bus), depending on its arguments "DESLOCAMENTOS" and "CIRCULAR".
The argument CIRCULAR = TRUE sums the estimative of time waiting for a circular bus to the total time model. 
This estimative uses the "Waiting time paradox" (https://jakevdp.github.io/blog/2018/09/13/waiting-time-paradox/) and it's a fixed value for USP. This value has been calculated in python (because all the available codes used numpy or another python library) and the code is available here (http://ecologia.ib.usp.br/bie5782/lib/exe/fetch.php?media=bie5782:01_curso_atual:alunos:trabalho_final:mila.barbosa:waitingtimeparadox.txt).


Value:

   BandejaR returns a dataframe with the estimated times (in minutes) that the user would spend having lunch in the four university restaurants of USP.
 

Note:

     BandejaR provides an estimative of time and considers only some of the parameters that may influence the time users spend to use the "bandejes". 
     There may be other variables that influence this model and I believe that it can be improved (especially if there was the information about how many people were in the line in each restaurant).
     Although, some people have tested the current model and our estimates were very close to the real time spent in this activity.

Author(s):

     Mila Maria Pamplona Barbosa

References:
	Waiting Time Paradox: https://jakevdp.github.io/blog/2018/09/13/waiting-time-paradox/
	Lines Theory: https://www.fm2s.com.br/teoria-das-filas/ 
	Lines Theory.2: http://www.grima.ufsc.br/software/Filas/Filas.html
     

Examples:
	We can run bandejaR with one of the two data.frames: . You can download them by copying the links below and pasting them into your browser.
	http://ecologia.ib.usp.br/bie5782/lib/exe/fetch.php?media=bie5782:01_curso_atual:alunos:trabalho_final:mila.barbosa:deslocamentos_bandejoes_andando.csv
	http://ecologia.ib.usp.br/bie5782/lib/exe/fetch.php?media=bie5782:01_curso_atual:alunos:trabalho_final:mila.barbosa:deslocamentos_bandejoes_carro.csv
	>deslocamentos.carro =read.table (file = "deslocamentos_bandejoes_carro.csv", header = TRUE, sep = ",") #carrega a planilha de deslocamentos de carro, caso o usurio v bandejar de carro ou de circular
	>bandejaR(deslocamentos = deslocamentos.carro, IES_ORIGEM = "ib",chuva = TRUE, circular = TRUE, card_pref = "Bom", card_fis = "Bom", card_quim = "Bom", card_cen = "Medio") #retorna o tempo para bandejaR nos quatro bandejes, saindo do ib e esperando pelo circular
or
	>deslocamentos.ape = read.table (file = "deslocamentos_bandejoes_andando.csv", header = TRUE, sep = ",") #carrega a planilha de deslocamentos a p, caso o usurio v bandejar andando
	>bandejaR(deslocamentos = deslocamentos.carro, IES_ORIGEM = "ib",chuva = TRUE, circular = TRUE, card_pref = "Bom", card_fis = "Bom", card_quim = "Bom", card_cen = "Medio") #retorna o tempo para bandejaR nos quatro bandejes, saindo do ib e indo a p
